﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace SharePointOptimizer.PL.WPF
{
    public class IssueDatabase
    {
        public IssueDatabase()
        {
            Categories = new ObservableCollection<IssueCategory>();
        }
        public String Name { get; set; }
        public ObservableCollection<IssueCategory> Categories { get; set; }


        public int TotalNumberOfIssues()
        {
            int numberOfIssue = 0;


            foreach (var cat in Categories)
            {
                numberOfIssue += cat.Issues.Count;
            }

            return numberOfIssue;

        }
        public override string ToString()
        {
            return "Database: " + this.Name + " (" + TotalNumberOfIssues().ToString() + " issues)";
        }

    }
}
